package com.lzw.breezeNovel.webApp.controller.video;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.webApp.service.video.VideoCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.video
 * @date 2025/3/19
 * @description 视频收藏
 */
@RestController
@RequestMapping("/app/video/collect")
@SuppressWarnings("all")
public class VideoCollectController {

    /**
     * 注入service
     */
    @Autowired
    private VideoCollectService videoCollectService;

    /**
     * 添加收藏
     */
    @RequestMapping("/add")
    public Result addCollect(@RequestParam Integer type,@RequestParam Long videoId){
        videoCollectService.addCollect(type,videoId);
        return Result.ok();
    }

    /**
     * 取消收藏
     */
    @RequestMapping("/cancel")
    public Result cancelCollect(@RequestParam Integer type,@RequestParam Long videoId){
        videoCollectService.cancelCollect(type,videoId);
        return Result.ok();
    }

    /**
     * 判断是否收藏
     */
    @RequestMapping("/isCollect")
    public Result<Boolean> isCollect(@RequestParam Integer type,@RequestParam Long videoId){
        return Result.ok(videoCollectService.isCollect(type,videoId));
    }

}
